Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(zarinpal-http.ts): updated error section, handle empty array #13

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

mobintmu
Copy link
Contributor

Description

Thanks for your contribution. In new version of Zarinpal response, they sent empty array of errors and it made a bug on the application.

  data: {
    wages: [],
    code: 101,
    message: 'Verified',
    card_hash: 'XXXXX',
    card_pan: '11111*****111',
    ref_id: 5XXXXXXXX,
    fee_type: 'Merchant',
    fee: 3500,
    shaparak_fee: '1200',
    order_id: null
  },
  errors: []

Please check and fix this problem. Thanks

@mehdi-ra mehdi-ra self-assigned this Aug 1, 2024
@mehdi-ra
Copy link
Owner

mehdi-ra commented Aug 1, 2024

I'm on it dear @mobintmu. Thanks for contribution.

Copy link
Owner

@mehdi-ra mehdi-ra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you modify code as:

      if (request?.errors && Array.isArray(request.errors) && request.errors.length > 0) {
        throw new ZarinpalError(request.errors.code);
      }

And can you tell me witch version you are using ?

@mobintmu
Copy link
Contributor Author

mobintmu commented Aug 1, 2024

I have updated the code. Thanks

Copy link
Owner

@mehdi-ra mehdi-ra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mehdi-ra mehdi-ra changed the title [Fix] empty array of error fix(zarinpal-http.ts): updated error section, handle empty array Aug 1, 2024
@mehdi-ra mehdi-ra merged commit bdf77a2 into mehdi-ra:main Aug 1, 2024
@mehdi-ra
Copy link
Owner

mehdi-ra commented Aug 1, 2024

@mobintmu jan, Can you check the version 1.1.1 recently released ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants